<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <script src="https://code.jquery.com/jquery-1.11.2.js"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.js"></script>
        <script src="../../dist/ocLazyLoad.js"></script>

    </head>
    <body>
        <div id="example" ng-app="LazyLoadTest" ng-controller="TestController"></div>
        <script>
            angular.module("LazyLoadTest", ["oc.lazyLoad"])
                .controller("TestController", function($scope, $ocLazyLoad, $compile) {
                    $ocLazyLoad.load("js/testApp.js").then(function() {
                        console.log('loaded!!');
                        var el, elToAppend;
                        elToAppend = $compile('<say-hello to="world"></say-hello>')($scope);
                        el = angular.element('#example');
                        el.append(elToAppend);
                    }, function(e) {
                        console.log('errr');
                        console.error(e);
                    })
                });
        </script>
    </body>
</html>
